package so.wy.servicecenter.businessbed.service.push.dto;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import lombok.NoArgsConstructor;
import so.wy.servicecenter.businessbed.dao.rdb.push_history.PushHistoryDO;

import java.util.Date;

/**
* @author wdl
* @date 2020-04-11
*/
@Data
@NoArgsConstructor
public class PushHistoryDTO{

	/** 主键ID */
	private Long id;
	/** 推送时间 */
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
	private Date pushTime;
	/** 推送方式 */
	private Integer pushType;
	/** 推送方 */
	private String pushSender;
	/** 接收方 */
	private String pushReceiver;
	/** 推送标题 */
	private String pushTitle;
	/** 推送内容 */
	private String pushContent;
	/** 推送状态 */
	private Integer pushStatus;
	/** 租户ID */
	private Long rentUserId;
	/** 排序 */
	private Integer sortNum;

	public PushHistoryDTO(PushHistoryDO pushHistoryDO){
		if(pushHistoryDO==null){
			return ;
		}

		this.id = pushHistoryDO.getId();
		this.pushTime = pushHistoryDO.getPushTime();
		this.pushType = pushHistoryDO.getPushType();
		this.pushSender = pushHistoryDO.getPushSender();
		this.pushReceiver = pushHistoryDO.getPushReceiver();
		this.pushTitle = pushHistoryDO.getPushTitle();
		this.pushContent = pushHistoryDO.getPushContent();
		this.pushStatus = pushHistoryDO.getPushStatus();
		this.rentUserId = pushHistoryDO.getRentUserId();
		this.sortNum = pushHistoryDO.getSortNum();
	}

	public PushHistoryDO convert2DO(){
		PushHistoryDO pushHistoryDO = new PushHistoryDO();
		pushHistoryDO.setId(this.id);
		pushHistoryDO.setPushTime(this.pushTime);
		pushHistoryDO.setPushType(this.pushType);
		pushHistoryDO.setPushSender(this.pushSender);
		pushHistoryDO.setPushReceiver(this.pushReceiver);
		pushHistoryDO.setPushTitle(this.pushTitle);
		pushHistoryDO.setPushContent(this.pushContent);
		pushHistoryDO.setPushStatus(this.pushStatus);
		pushHistoryDO.setRentUserId(this.rentUserId);
		pushHistoryDO.setSortNum(this.sortNum);
		return pushHistoryDO;
	}

}
